package com.zq.car.test;

import com.zq.car.dao.entity.CartInfo;
import com.zq.car.service.ICartInfoService;
import com.zq.common.util.JwtUtil;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.math.BigDecimal;

/**
 * @Author 张乔
 * @Date 2025/2/1 17:11
 */
@SpringBootTest
public class test01 {


@Resource
    private ICartInfoService cartInfoService;

@Test
    void ll(){
    CartInfo cartInfo = new CartInfo();
    cartInfo.setUserId(22L);
    cartInfo.setSkuId(222L);
    cartInfo.setSkuNum(20);
    cartInfo.setSkuName("小米");
    cartInfo.setCartPrice(BigDecimal.valueOf(20.5));
    cartInfoService.save(cartInfo);


}

@Resource
private JwtUtil jwtUtil;

@Test
    void test02() {
String token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2IiwiZXhwIjoxNzE3MTExMTkzLCJpYXQiOjE3MTcwNzUxOTN9.R9ZGFcSeQBIPYQt6hPgbWlrCuuUrPCR35cpswcJkX18";
    Integer integer = jwtUtil.getUsernameFromToken(token);

    System.out.println(integer);
}


}
